/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.ufc.quixada.adrs.comandos.adrs;

import br.ufc.quixada.adrs.interfaces.Comando;
import br.ufc.quixada.adrs.model.Visita;
import br.ufc.quixada.adrs.service.VisitaService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Caio
 */
public class CmdEditarVisita implements Comando{

    public String executa(HttpServletRequest request, HttpServletResponse response) {
        HttpSession session = request.getSession();
            Visita v = new VisitaService().getVisitaById(Long.parseLong(request.getParameter("id")));

            session.setAttribute("visita", v);
            return "/adrs/adrs_add_visita.jsp";
    }
}
